<?php
/**
 * Created by PhpStorm.
 * User: sky
 * Date: 2016/1/22
 * Time: 17:40
 */

use yii\helpers\Url;
use app\lib\WeixinUtils;

$web = Url::to("@web");
//var_dump($bagInfo);
//die;
//获取微信js
$sign= WeixinUtils::getJs_SignPackage();
?>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta content="telephone=no" name="format-detection" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <title>送礼记录详情</title>
    <link href="<?= $web ?>/css/global.css" rel="stylesheet" />
    <link href="<?= $web ?>/css/bag/send-gift-detail.css" rel="stylesheet" />
    <script src="<?= $web ?>/js/jquery.js"></script>
    <script src="<?= $web ?>/js/tools.js"></script>
    <script src="<?= $web ?>/js/wx/wx_utils.js"></script>
    <script src="http://res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
    <meta charset="utf-8" />

    <script type="text/javascript">
        $(function ()
        {
            // 任何需要执行的js特效
            var w = $(document).width();
            if (w > 640)
            {
                w = 640;
            }
            $("body").css("font-size", w * 20 / 320);
        });


        wx.config({
            debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
            appId: '<?=APPID?>', // 必填，公众号的唯一标识
            timestamp:<?=$sign['timestamp']?> , // 必填，生成签名的时间戳
            nonceStr: '<?=$sign['nonceStr']?>', // 必填，生成签名的随机串
            signature: '<?=$sign['signature']?>',// 必填，签名，见附录1
            jsApiList: jsApiList_order_share// 必填，需要使用的JS接口列表，所有JS接口列表见附录2
        });
        wx.ready(function(){
			var url="<?=Url::to(["wx-bag/gift-receive",'order_code'=>$bagInfo['CODE']],true);?>";
			wx_setShare({
				title: '<?=$bagInfo['NICK_NAME']?>送你朵拉礼包', // 分享标题
                desc: '点击兑换朵拉盒好礼！朵拉超越你的想象，精彩好礼随心兑换！送心意、送逼格！送礼就选朵拉盒 ', // 分享描述
                link: url // 分享链接  receive-gift
			});
			
        });

    function href_view(){
        window.location.href = "<?=Url::to(["wx-bag/send-gift-detail-view","order_code"=>$bagInfo['CODE']]);?>";
    }
    function create_qr(){


        var imgUrl="<?=Url::to(['common/qr-code-out'
            ,'text'=>Url::to(["wx-bag/gift-receive", 'order_code' => $bagInfo['CODE']], true)
            ,'size'=>10
            ,'margin'=>1])?>";

        $('#img_qr').attr('src',imgUrl);
        $('#div_qr').show();
    }
    </script>
</head>
<body>
<div id="div_qr" style="display: none;position: fixed;top:0em;" >
    <div onclick=" $('#div_qr').hide();" style="width: 100%;height: 100%;position: fixed;top:0em;background-color: black;opacity: 0.5;"></div>
    <img id="img_qr" style="position: fixed;top:5em;left:3em;width: 10em;height: 10em;"/>
</div>
<div class="main">
    <div class="gift-container">
        <div class="title-container" style="background-image: url('<?= $web ?>/img/bag/title-bg.png');">
            <div class="title-content">
                <div class="logo" onclick="create_qr()" style="background-image: url('<?= $web ?>/img/bag/gift-receives/rectangle-qr.png');"></div>
                <div class="logo-text" style="background-image: url('<?= $web ?>/img/bag/gift-receives/rectangle1.png');"> </div>
                <div class="title">
                    <table cellspacing="0" cellpadding="0">
                        <tr>
                            <td id="title-main"> <?php
                               $bag_name= $bagInfo['BAG_NAME'];
                               $nick_name= $bagInfo['NICK_NAME'];

                                if($bag_name==""){

                                    echo "来自{$nick_name}的朵拉礼包";
                                }else{
                                    echo $bagInfo['BAG_NAME'];
                                }


                                ?></td>
                        </tr>
                        <tr>
                            <td id="title-desc">有效期：永久</td>
                        </tr>
                    </table>
                </div>
                <div class="title-right"></div>

            </div>
            <div class="bless-container">
                <div class="user-head">
                    <img src="<?= $bagInfo['HEADER_URL'] ?>" />
                </div>
                <div class="user-bless">
                    <table cellpadding="0" cellspacing="0">
                        <tr>
                            <td id="user-target"><?=$bagInfo['NICK_NAME']?>：</td>
                        </tr>
                        <tr>
                            <td id="bless-text"><?=$bagInfo['BLESSING']?></td>
                        </tr>
                    </table>
                </div>
            </div>
            <div class="split-black"></div>
            <div class="duora-info">
<!--                <div id="duora-num">-->
<!--                    此礼包 <span>--><?//=$count?><!--</span> 个商品，已被领取 <span>--><?//=$receive_count?><!--</span> 个，剩余 <span>--><?//=$count-$receive_count?><!--</span> 个未领取-->
<!--                </div>-->
                <div id="duora-num">
                    <label>此礼包</label>
                    <span><?= $count ?></span>
                    <label>个商品，已被领取</label>
                    <span><?= $receive_count ?></span>
                    <label> 个，剩余</label>
                    <span><?= $count - $receive_count ?></span>
                    <label> 个未领取</label>
                </div>
            </div>
        </div>
    </div>
    <div class="btn-receive" onclick="href_view();">查看礼包详情</div>
    <div class="lists">
        <?php
            foreach($receive_infoList as &$receive_info){
                ?>
                <div class="list-item">
                    <div id="user-head">
                        <img src="<?= $receive_info['HEADER_URL'] ?>" />
                    </div>
                    <div class="item">
                        <div class="item-name">
                            <label style="color: #5d5c5c;"><?= $receive_info['NICK_NAME'] ?>&nbsp;已兑换&nbsp;</label><label
                                style="color: #d7000f;"><?= $receive_info['GOODS_NAME'] ?></label>
                        </div>
<!--                        --><?//= $receive_info['NICK_NAME'] ?><!-- 已领取  <span>--><?//= $receive_info['GOODS_NAME'] ?><!--</span>-->
                    </div>
                    <div class="item-time"><?=$receive_info['SHOW_USER_GET_DATETIME']?></div>
                </div>

                <?php
            }
        ?>

       <!-- <div class="list-item">
            <div id="user-head">
                <img src="<?/*= $web */?>/img/bag/gift-receives/userhead.jpg" />
            </div>
            <div class="item">
                谢勋 已兑换 <span>黑檀木招财金龙鱼摆件</span>
            </div>
            <div class="item-time">01-23</div>

        </div>-->
    </div>

</div>
</body>
</html>
